package holaMundo;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class HolaVerano extends MIDlet implements CommandListener{

	Display display;
	Form form1;
	Form form2;
	Command comando1;
	Command comando2;

	public HolaVerano() {

		display = Display.getDisplay(this);
		
		form1 = new Form("Pantalla 1");
		form2 = new Form("Pantalla 2");
		
		display.setCurrent(form1);

		comando1 = new Command("avanza",
				Command.ITEM,
				1);
		
		comando2 = new Command("retrocede",
				Command.ITEM,
				2);
		
		form1.addCommand(comando1);
		form2.addCommand(comando2);
		form1.setCommandListener(this);
		form2.setCommandListener(this);

	}

	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
		// TODO Auto-generated method stub

	}

	protected void pauseApp() {
		// TODO Auto-generated method stub

	}

	protected void startApp() throws MIDletStateChangeException {
		// TODO Auto-generated method stub

	}

	public void commandAction(Command arg0, Displayable arg1) {

		if(arg0.equals(comando1))
			display.setCurrent(form2);
		if(arg0.equals(comando2))
			display.setCurrent(form1);
	}

}
